#pragma once
#include "EventBase.h"

namespace Core{
	class EventConnection{
	public:
		EventConnection(void* r, void* e):
		  m_registree(r),m_event(e),m_unregged(false){}

		~EventConnection(){
			if(!m_unregged)
				unregister(); 
		}
	private:
		void unregister(){
			static_cast<EventBase*>(m_event)->unregisterHandler(m_registree);
			m_unregged = true;
		}

		bool 	m_unregged;
		void	*m_event,
				*m_registree;
	};
}